package com.han.practice;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 美团模拟笔试-3
 * 数组中两两求和，使和的最大值与最小值的差值最小
 */
public class MinDifference {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int len = sc.nextInt();
        int[] arr = new int[len];
        for(int i=0; i<len; i++) arr[i] = sc.nextInt();

        Arrays.sort(arr);

        int[] reArr = new int[len/2];
        for(int i=0; i<len/2; i++){
            reArr[i] = arr[i]+arr[len-i-1];
        }

        Arrays.sort(reArr);

        int minDiff = reArr[len/2-1];
        for(int i=0; i<len/2-1; i++){
            int tmp = reArr[i+1] - reArr[i];
            minDiff = minDiff < tmp ? minDiff : tmp;
        }
        System.out.println(minDiff);
    }
}
